package demo.dragdemo;
import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JSplitPane;
import javax.swing.JButton;
import javax.swing.BoxLayout;


public class DragTestFrame extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					DragTestFrame frame = new DragTestFrame();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public DragTestFrame() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 634, 515);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		ControlDragManager manager;
		setContentPane(contentPane);

		JSplitPane splitPane = new JSplitPane();
		contentPane.add(splitPane, BorderLayout.CENTER);

		JPanel panel = new JPanel();
		panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
		splitPane.setLeftComponent(panel);

		JButton button1 = new JButton("Btn1");
		panel.add(button1);

		JButton button2 = new JButton("Btn2");
		panel.add(button2);

		JLabel lable = new JLabel("lbl1");
		panel.add(lable);
		
		JCheckBox box = new JCheckBox("lbl1");
		panel.add(box);

		JPanel panel1 = new JPanel();
		panel1.setLayout(null);
		splitPane.setRightComponent(panel1);

		manager = new ControlDragManager(this, panel1);
		manager.canDrag(button1);
		manager.canDrag(button2);
		manager.canDrag(lable);
		manager.canDrag(box);
		
	}

}
